package com.framework.spring.enhancer.util;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * @Title:
 * @Description: 功能概述:
 * @Author: lihaiyang
 * @version: 1.0 .
 * @Date: 2023-12-26 15:08
 * @Copyright: Copyright(c)2023
 */
@Slf4j(topic = "e")
public class MyCallback implements MethodInterceptor {
	@Override
	public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
		if (method.getName().equals("m0")) {
			log.info("m0相当于加了@Bean");
			log.info("getBean");
		} else {
			return methodProxy.invokeSuper(o, objects);
		}
		return null;
	}
}
